

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  
  <title>Joints &mdash; NVIDIA PhysX SDK 4.1 Documentation</title>
  

  
  <link rel="shortcut icon" href="_static/images/favicon.ico"/>

  
  

  

  
  
    

  
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
    <link rel="next" title="Articulations" href="Articulations.html" />
    <link rel="prev" title="Advanced Collision Detection" href="AdvancedCollisionDetection.html" />
    <link href="../_static/css/nvidia_theme.css" rel="stylesheet" type="text/css">
    
    
        <style>
            .wy-nav-content::before {
                content: "PhysX 4.1 SDK Guide";
            }
        </style>
    


  
  <script src="../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../Index.html" class="icon icon-home"> Python
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="Index.html">User's Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="License.html">PhysX License</a></li>
<li class="toctree-l2"><a class="reference internal" href="Introduction.html">Welcome to PhysX</a></li>
<li class="toctree-l2"><a class="reference internal" href="HelloWorld.html">Snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="BuildingWithPhysX.html">Building with PhysX</a></li>
<li class="toctree-l2"><a class="reference internal" href="API.html">The PhysX API</a></li>
<li class="toctree-l2"><a class="reference internal" href="Startup.html">Startup and Shutdown</a></li>
<li class="toctree-l2"><a class="reference internal" href="Threading.html">Threading</a></li>
<li class="toctree-l2"><a class="reference internal" href="Geometry.html">Geometry</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyOverview.html">Rigid Body Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyCollision.html">Rigid Body Collision</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyDynamics.html">Rigid Body Dynamics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Simulation.html">Simulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="AdvancedCollisionDetection.html">Advanced Collision Detection</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Joints</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#joint-basics">Joint Basics</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#visualization">Visualization</a></li>
<li class="toctree-l4"><a class="reference internal" href="#force-reporting">Force Reporting</a></li>
<li class="toctree-l4"><a class="reference internal" href="#breakage">Breakage</a></li>
<li class="toctree-l4"><a class="reference internal" href="#projection">Projection</a></li>
<li class="toctree-l4"><a class="reference internal" href="#limits">Limits</a></li>
<li class="toctree-l4"><a class="reference internal" href="#actuation">Actuation</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mass-scaling">Mass Scaling</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#fixed-joint">Fixed Joint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#spherical-joint">Spherical Joint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#revolute-joint">Revolute Joint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#prismatic-joint">Prismatic Joint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#distance-joint">Distance Joint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#d6-joint">D6 Joint</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#locking-and-unlocking-axes">Locking and Unlocking Axes</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">Limits</a></li>
<li class="toctree-l4"><a class="reference internal" href="#drives">Drives</a></li>
<li class="toctree-l4"><a class="reference internal" href="#configuring-joints-for-best-behavior">Configuring Joints for Best Behavior</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#custom-constraints">Custom Constraints</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#defining-constraint-behavior">Defining Constraint Behavior</a></li>
<li class="toctree-l4"><a class="reference internal" href="#the-constraint-shader-table">The Constraint Shader Table</a></li>
<li class="toctree-l4"><a class="reference internal" href="#data-management">Data Management</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html">Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-and-reduced-articulations">Maximal Coordinate and Reduced Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-articulations">Maximal Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#reduced-coordinate-articulations">Reduced Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="OriginShift.html">Scene Origin</a></li>
<li class="toctree-l2"><a class="reference internal" href="GPURigidBodies.html">GPU Rigid Bodies</a></li>
<li class="toctree-l2"><a class="reference internal" href="GeometryQueries.html">Geometry Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="SceneQueries.html">Scene Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="Vehicles.html">Vehicles</a></li>
<li class="toctree-l2"><a class="reference internal" href="CharacterControllers.html">Character Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="DebugVisualization.html">Debug Visualization</a></li>
<li class="toctree-l2"><a class="reference internal" href="VisualDebugger.html">PhysX Visual Debugger (PVD)</a></li>
<li class="toctree-l2"><a class="reference internal" href="Statistics.html">Simulation Statistics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Serialization.html">Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="ExtendingSerialization.html">Extending Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="BestPractices.html">Best Practices Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationFrom28.html">Migrating From PhysX SDK 2.x to 3.x</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo33.html">Migrating From PhysX SDK 3.2 to 3.3</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo34.html">Migrating From PhysX SDK 3.3 to 3.4</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo40.html">Migrating From PhysX SDK 3.4 to 4.0</a></li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../Index.html">Python</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../Index.html">Docs</a> &raquo;</li>
        
          <li><a href="Index.html">User's Guide</a> &raquo;</li>
        
      <li>Joints</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="joints">
<span id="id1"></span><h1>Joints<a class="headerlink" href="#joints" title="Permalink to this headline">¶</a></h1>
<div class="section" id="joint-basics">
<h2>Joint Basics<a class="headerlink" href="#joint-basics" title="Permalink to this headline">¶</a></h2>
<p>A joint constrains the way two actors move relative to one another. A typical use for a joint would be to model a door hinge or the shoulder of a character. Joints are implemented in the PhysX extensions library and cover many common scenarios, but if you have use cases that are not met by the joints packaged with PhysX, you can implement your own. Since joints are implemented as extensions, the pattern for creating them is slightly different from other PhysX objects.</p>
<p>Creation of simple joints and limits is demonstrated in the SnippetJoint snippet.</p>
<p>To create a joint, call the joint's creation function:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxRevoluteJointCreate</span><span class="p">(</span><span class="n">PxPhysics</span><span class="o">&amp;</span> <span class="n">physics</span><span class="p">,</span>
                      <span class="n">PxRigidActor</span><span class="o">*</span> <span class="n">actor0</span><span class="p">,</span> <span class="k">const</span> <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">localFrame0</span><span class="p">,</span>
                      <span class="n">PxRigidActor</span><span class="o">*</span> <span class="n">actor1</span><span class="p">,</span> <span class="k">const</span> <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">localFrame1</span><span class="p">);</span>
</pre></div>
</div>
<p>This has the same pattern for all joints: two actors, and for each actor a constraint frame.</p>
<p>One of the actors must be movable, either a <em>PxRigidDynamic</em> or a <em>PxArticulationLink</em>. The other may be of one of those types, or a <em>PxRigidStatic</em>. Use a NULL pointer here to indicate an implicit actor representing the immovable global reference frame.</p>
<p>Each localFrame argument specifies a constraint frame relative to the actor's global pose. Each joint defines a relationship between the global positions and origins of the constraint frames that will be enforced by the PhysX constraint solver. In this example, the revolute joint constrains the origin points of the two frames to be coincident and their x-axes to coincide, but allows the two actors to rotate freely relative to one another around this common axis.</p>
<p>PhysX supports six different joint types:</p>
<ul class="simple">
<li>a <strong>fixed</strong> joint locks the orientations and origins rigidly together</li>
<li>a <strong>distance</strong> joint keeps the origins within a certain distance range</li>
<li>a <strong>spherical</strong> joint (also called a <em>ball-and-socket</em>) keeps the origins together, but allows the orientations to vary freely.</li>
<li>a <strong>revolute</strong> joint (also called a <em>hinge</em>) keeps the origins and x-axes of the frames together, and allows free rotation around this common axis.</li>
<li>a <strong>prismatic</strong> joint (also called a <em>slider</em>) keeps the orientations identical, but allows the origin of each frame to slide freely along the common x-axis.</li>
<li>a <strong>D6</strong> joint is a highly configurable joint that allows specification of individual degrees of freedom either to move freely or be locked together. It can be used to implement a wide variety of mechanical and anatomical joints, but is somewhat less intuitive to configure than the other joint types. This joint is covered in detail below.</li>
</ul>
<p>All joints are implemented as plugins to the SDK through the PxConstraint class. A number of the properties for each joint are configured using the PxConstraintFlag enumeration.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">As in the rest of the PhysX API, all joint angles for limits and drive targets are specified in radians.</p>
</div>
<div class="section" id="visualization">
<h3>Visualization<a class="headerlink" href="#visualization" title="Permalink to this headline">¶</a></h3>
<p>All standard PhysX joints support debug visualization. You can visualize the joint frames of each actor, and also any limits the joint may have.</p>
<p>By default, joints are not visualized. To visualize a joint, set its visualization constraint flag and the appropriate scene-level visualization parameters:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">scene</span><span class="o">-&gt;</span><span class="n">setVisualizationParameter</span><span class="p">(</span><span class="n">PxVisualizationParameter</span><span class="o">::</span><span class="n">eJOINT_FRAMES</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">);</span>
<span class="n">scene</span><span class="o">-&gt;</span><span class="n">setVisualizationParameter</span><span class="p">(</span><span class="n">PxVisualizationParameter</span><span class="o">::</span><span class="n">eJOINT_LIMITS</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">);</span>

<span class="p">...</span>

<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setConstraintFlag</span><span class="p">(</span><span class="n">PxConstraintFlag</span><span class="o">::</span><span class="n">eVISUALIZATION</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="force-reporting">
<h3>Force Reporting<a class="headerlink" href="#force-reporting" title="Permalink to this headline">¶</a></h3>
<p>The force applied at a joint may be retrieved after simulation with a call to getForce():</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">scene</span><span class="o">-&gt;</span><span class="n">fetchResults</span><span class="p">(...)</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">getConstraint</span><span class="p">().</span><span class="n">getForce</span><span class="p">(</span><span class="n">force</span><span class="p">,</span> <span class="n">torque</span><span class="p">);</span>
</pre></div>
</div>
<p>The force is resolved at the origin of actor1's joint frame.</p>
<p>Note that this force is only updated while the joint's actors are awake.</p>
</div>
<div class="section" id="breakage">
<h3>Breakage<a class="headerlink" href="#breakage" title="Permalink to this headline">¶</a></h3>
<p>All of the standard PhysX joints can be made <em>breakable</em>. A maximum breaking force and torque may be specified, and if the force or torque required to maintain the joint constraint exceeds this threshold, the joint will break. Breaking a joint generates a simulation event (see PxSimulationEventCallback::onJointBreak), and the joint no longer partakes in simulation, although it remains attached to its actors until it is deleted.</p>
<p>By default the threshold force and torque are set to FLT_MAX, making joints effectively unbreakable. To make a joint breakable, specify the force and torque thresholds.</p>
<p>joint-&gt;setBreakForce(100.0f, 100.0f);</p>
<p>A constraint flag records whether a joint is currently broken:</p>
<p>bool broken = (joint-&gt;getConstraintFlags() &amp; PxConstraintFlag::eBROKEN) != 0;</p>
<p>Breaking a joint causes a callback via PxSimulationEventCallback::onConstraintBreak. In this callback, a pointer to the joint and its type are specified in the externalReference and type field of the PxConstraintInfo struct. If you have implemented your own joint types, use the PxConstraintInfo::type field to determine the dynamic type of the broken constraint. Otherwise, simply cast the externalReference to a PxJoint:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MySimulationEventCallback</span>
<span class="p">{</span>
    <span class="kt">void</span> <span class="n">onConstraintBreak</span><span class="p">(</span><span class="n">PxConstraintInfo</span><span class="o">*</span> <span class="n">constraints</span><span class="p">,</span> <span class="n">PxU32</span> <span class="n">count</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="k">for</span><span class="p">(</span><span class="n">PxU32</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="n">count</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
        <span class="p">{</span>
            <span class="n">PxJoint</span><span class="o">*</span> <span class="n">joint</span> <span class="o">=</span> <span class="k">reinterpret_cast</span><span class="o">&lt;</span><span class="n">PxJoint</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">constraints</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">externalReference</span><span class="p">);</span>
            <span class="p">...</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="projection">
<h3>Projection<a class="headerlink" href="#projection" title="Permalink to this headline">¶</a></h3>
<p>Under stressful conditions, PhysX' dynamics solver may not be able to accurately enforce the constraints specified by the joint. PhysX provides kinematic <em>projection</em> which tries to bring violated constraints back into alignment even when the solver fails. Projection is not a physical process and does not preserve momentum or respect collision geometry. It is best avoided if practical, but can be useful in improving simulation quality where joint separation results in unacceptable artifacts.</p>
<p>By default projection is disabled. To enable projection, set the linear and angular tolerance values beyond which a joint will be projected, and set the constraint projection flag:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setProjectionLinearTolerance</span><span class="p">(</span><span class="mf">0.1f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setConstraintFlag</span><span class="p">(</span><span class="n">PxConstraintFlag</span><span class="o">::</span><span class="n">ePROJECTION</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>Very small tolerance values for projection may result in jittering around the joint.</p>
<p>A constraint with projection enabled can be part of a graph of rigid bodies connected by constraints. If this graph is acyclic, the algorithm will choose a root node among the connected rigid bodies, traverse the graph, and project the bodies towards the root. If the constraint graph has cycles, the algorithm will split the graph into multiple acyclic subgraphs, dropping edges that create cycles, and do the projection separately for each. Please note that having more than one constraint attached to a fixed anchor (world or static/kinematic rigid body) in a graph does count as a cycle (for example, a chain of rigid bodies connected with constraints and both ends attached to world anchors).
If multiple constraints fight over the same body or conflicting projection directions are specified, the projection direction will be chosen based on the following priorities (highest first):</p>
<ul class="simple">
<li>world attachment or a rigid static actor with a projecting constraint</li>
<li>kinematic actor with a projecting constraint</li>
<li>all dominant dynamic actor (has projecting constraints and all of them are one-way projecting towards this dynamic)</li>
<li>dominant dynamic actor (same as above but there is at least one two-way projecting constraint as well)</li>
<li>partially dominant dynamic actor (has at least one one-way projecting constraint towards this dynamic and at least one one-way projecting constraint towards an other actor)</li>
<li>world attachment or a rigid static actor without any projecting constraints</li>
<li>kinematic actor without any projecting constraints</li>
<li>dynamic actor with or without two-way projecting constraints to other dynamics (among these, the one with the highest constraint count wins)</li>
</ul>
</div>
<div class="section" id="limits">
<h3>Limits<a class="headerlink" href="#limits" title="Permalink to this headline">¶</a></h3>
<p>Some PhysX joints constrain not just relative rotation or translation, but can also enforce <em>limits</em> on the range of that motion. For example, in its initial configuration the revolute joint allows free rotation around its axis, but by specifying and enabling a limit, lower and upper bounds may be placed upon the angle of rotation.</p>
<p>Limits are a form of collision, and like collision of rigid body shapes, stable limit behavior requires a <em>contactDistance</em> tolerance specifying how far from the limit the joint configuration may be before the solver tries to enforce it. Note that enforcement always starts before the limit is violated, so the role played by contactDistance for limits is analogous to the role a positive contactDistance value plays in collision detection. A larger contact makes the limit less likely to be violated even at high relative velocity. However, because the limit is active more of the time, the joint is more expensive to simulate.</p>
<p>Limit configuration is specific to each type of joint. To set a limit, configure the limit geometry and set the joint-specific flag indicating that the limit is enabled:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">revolute</span><span class="o">-&gt;</span><span class="n">setLimit</span><span class="p">(</span><span class="n">PxJointAngularLimitPair</span><span class="p">(</span><span class="o">-</span><span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="mf">0.1f</span><span class="p">));</span> <span class="c1">// upper, lower, tolerance</span>
<span class="n">revolute</span><span class="o">-&gt;</span><span class="n">setRevoluteJointFlag</span><span class="p">(</span><span class="n">PxRevoluteJointFlag</span><span class="o">::</span><span class="n">eLIMIT_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>Limits may be either <em>hard</em> or <em>soft</em>. When a hard limit is reached, relative motion will simply stop dead if the limit is configured with zero restitution, or bounce if the restitution is non-zero. When a soft limit is violated, the solver will pull the joint back towards the limit using a spring specified by the limit's spring and damping parameters. By default, limits are hard and without restitution, so when the joint reaches a limit motion will simply stop. To specify softness for a limit, declare the limit structure and set the spring and damping parameters directly:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxJointAngularLimitPair</span> <span class="nf">limitPair</span><span class="p">(</span><span class="o">-</span><span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="mf">0.1f</span><span class="p">));</span>
<span class="n">limitPair</span><span class="p">.</span><span class="n">spring</span> <span class="o">=</span> <span class="mf">100.0f</span><span class="p">;</span>
<span class="n">limitPair</span><span class="p">.</span><span class="n">damping</span> <span class="o">=</span> <span class="mf">20.0f</span><span class="p">;</span>
<span class="n">revolute</span><span class="o">-&gt;</span><span class="n">setRevoluteJointLimit</span><span class="p">(</span><span class="n">limitPair</span><span class="p">);</span>
<span class="n">revolute</span><span class="o">-&gt;</span><span class="n">setRevoluteJointFlag</span><span class="p">(</span><span class="n">PxRevoluteJointFlag</span><span class="o">::</span><span class="n">eLIMIT_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Limits are not projected.</p>
</div>
<p>When using spring limits, the eACCELERATION flag is strongly recommended. This flag will automatically scale the strength of the spring according to the masses and inertias of objects that the limit is acting upon, and can substantially reduce the amount of tuning required for good, stable behavior.</p>
</div>
<div class="section" id="actuation">
<h3>Actuation<a class="headerlink" href="#actuation" title="Permalink to this headline">¶</a></h3>
<p>Some PhysX joints may be actuated by a motor or a spring implicitly integrated by the PhysX solver. While driving simulations with actuated joints is more expensive than simply applying forces, it can provide much more stable control of simulation. See <a class="reference internal" href="#pxd6joint"><em>D6 Joint</em></a>, <a class="reference internal" href="#pxprismaticjoint"><em>Prismatic Joint</em></a>, and <a class="reference internal" href="#pxrevolutejoint"><em>Revolute Joint</em></a> for details</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The force generated by actuation is not included in the force reported by the solver, nor does it contribute towards exceeding the joint's breakage force threshold.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Changing the drive parameters for a joint, or activating or deactivating the drive, does not wake sleeping bodies attached to the joint. If required, wake these bodies manually.</p>
</div>
<p>When using spring drives (in particular, drives on the D6 joint), the eACCELERATION flag is strongly recommended. This flag will automatically scale the strength of the spring according to the masses and inertias of objects that the limit is acting upon, and can substantially reduce the amount of tuning required for good, stable behavior.</p>
</div>
<div class="section" id="mass-scaling">
<span id="joint-mass-scaling"></span><h3>Mass Scaling<a class="headerlink" href="#mass-scaling" title="Permalink to this headline">¶</a></h3>
<p>PhysX joints may apply scale to the mass and moment of inertia of the two connected bodies for the purposes of resolving a joint. For example, if you have two objects in a ragdoll of masses 1 and 10, PhysX will typically resolve the joint by changing the velocity of the lighter body much more than the heavier one. You can apply a mass scale of 10 to the first body to make PhysX change the velocity of both bodies by an equal amount. To ensure the same property holds for both linear and angular velocity, you should adjust the inertia scales in accordance with the bodies' inertias as well. Applying mass scales such that the joint sees similar effective masses and inertias makes the solver converge faster, which can make individual joints seem less rubbery or separated, and sets of jointed bodies appear less twitchy</p>
<p>Many applications that prioritize visual behavior over adherence to physical laws can benefit from tuning these scale values. But if you use this feature, bear in mind that mass and inertia scaling is fundamentally nonphysical. In general momentum will not be conserved, the energy of the system may increase, the force reported for the joint may be incorrect, and non-physical tuning of breakage thresholds and force limits may be required.</p>
</div>
</div>
<div class="section" id="fixed-joint">
<h2>Fixed Joint<a class="headerlink" href="#fixed-joint" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/fixedJoint.png" src="../_images/fixedJoint.png" />
<p>The fixed joint constrains two objects so that the positions and orientations of their constraint frames are the same.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">All joints are enforced by the dynamics solver, so although under ideal conditions the objects will maintain their spatial relationship, there may be some drift. A common alternative, which is cheaper to simulate and does not suffer from drift, is to construct a single actor with multiple shapes. However fixed joints are useful, for example, when a joint must be breakable or report its constraint force.</p>
</div>
</div>
<div class="section" id="spherical-joint">
<h2>Spherical Joint<a class="headerlink" href="#spherical-joint" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/sphericalJoint.png" src="../_images/sphericalJoint.png" />
<p>A spherical joint constrains the origins of the actor's constraint frames to be coincident.</p>
<p>The spherical joint supports a cone limit, which constrains the angle between the X-axes of the two constraint frames. Actor1's X-axis is constrained by a limit cone whose axis is the x-axis of actor0's constraint frame. The allowed limit values are the maximum rotation around the y- and z- axes of that frame. Different values for the y- and z- axes may be specified, in which case the limit takes the form of an elliptical angular cone:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setLimitCone</span><span class="p">(</span><span class="n">PxJointLimitCone</span><span class="p">(</span><span class="n">PxPi</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">PxPi</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mf">0.01f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setSphericalJointFlag</span><span class="p">(</span><span class="n">PxSphericalJointFlag</span><span class="o">::</span><span class="n">eLIMIT_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>Note that very small or highly elliptical limit cones may result in solver jitter.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><em>Visualization of the limit surface can help considerably in understanding its shape.</em></p>
</div>
</div>
<div class="section" id="revolute-joint">
<span id="pxrevolutejoint"></span><h2>Revolute Joint<a class="headerlink" href="#revolute-joint" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/revoluteJoint.png" src="../_images/revoluteJoint.png" />
<p>A revolute joint removes all but a single rotational degree of freedom from two objects. The axis along which the two bodies may rotate is specified by the common origin of the joint frames and their common x-axis. In theory, all origin points along the axis of rotation are equivalent, but simulation stability is best in practice when the point is near where the bodies are closest.</p>
<p>The joint supports a rotational limit with upper and lower extents. The angle is zero where the y- and z- axes of the joint frames are coincident, and increases moving from the y-axis towards the z-axis:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setLimit</span><span class="p">(</span><span class="n">PxJointLimitPair</span><span class="p">(</span><span class="o">-</span><span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="n">PxPi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="mf">0.01f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setRevoluteJointFlag</span><span class="p">(</span><span class="n">PxRevoluteJointFlag</span><span class="o">::</span><span class="n">eLIMIT_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>The joint also supports a motor which drives the relative angular velocity of the two actors towards a user-specified target velocity. The magnitude of the force applied by the motor may be limited to a specified maximum:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setDriveVelocity</span><span class="p">(</span><span class="mf">10.0f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setRevoluteJointFlag</span><span class="p">(</span><span class="n">PxRevoluteJointFlag</span><span class="o">::</span><span class="n">eDRIVE_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>By default, when the angular velocity at the joint exceeds the target velocity the motor acts as a brake; a freespin flag disables this braking behavior.</p>
<p>The drive force limit for a revolute joint may be interpreted either as a force or an impulse, depending on the value of PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES</p>
</div>
<div class="section" id="prismatic-joint">
<span id="pxprismaticjoint"></span><h2>Prismatic Joint<a class="headerlink" href="#prismatic-joint" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/prismJoint.png" src="../_images/prismJoint.png" />
<p>A prismatic joint prevents all rotational motion, but allows the origin of actor1's constraint frame to move freely along the x-axis of actor0's constraint frame. The prismatic joint supports a single limit with upper and lower bounds on the distance between the two constraint frames' origin points:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setLimit</span><span class="p">(</span><span class="n">PxJointLimitPair</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0f</span><span class="p">,</span> <span class="mf">20.0f</span><span class="p">,</span> <span class="mf">0.01f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setPrismaticJointFlag</span><span class="p">(</span><span class="n">PxPrismaticJointFlag</span><span class="o">::</span><span class="n">eLIMIT_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="distance-joint">
<h2>Distance Joint<a class="headerlink" href="#distance-joint" title="Permalink to this headline">¶</a></h2>
<img alt="../_images/distanceJoint.png" src="../_images/distanceJoint.png" />
<p>The distance joint keeps the origins of the constraint frames within a certain range of distance. The range may have both upper and lower bounds, which are enabled separately by flags:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">joint</span><span class="o">-&gt;</span><span class="n">setMaxDistance</span><span class="p">(</span><span class="mf">10.0f</span><span class="p">);</span>
<span class="n">joint</span><span class="o">-&gt;</span><span class="n">setDistanceJointFlag</span><span class="p">(</span><span class="n">eMAX_DISTANCE_ENABLED</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
</pre></div>
</div>
<p>In addition, when the joint reaches the limits of its range motion beyond this distance may either be entirely prevented by the solver, or pushed back towards its range with an implicit spring, for which spring and damping parameters may be specified.</p>
</div>
<div class="section" id="d6-joint">
<span id="pxd6joint"></span><h2>D6 Joint<a class="headerlink" href="#d6-joint" title="Permalink to this headline">¶</a></h2>
<p>The D6 joint is by far the most complex of the standard PhysX joints. In its default state it behaves like a fixed joint - that is, it rigidly fixes the constraint frames of its two actors. However, individual degrees of freedom may be unlocked to permit any combination of rotation around the x-, y- and z- axes, and translation along these axes.</p>
<div class="section" id="locking-and-unlocking-axes">
<h3>Locking and Unlocking Axes<a class="headerlink" href="#locking-and-unlocking-axes" title="Permalink to this headline">¶</a></h3>
<p>To unlock and lock degrees of freedom, use the joint's setMotion function:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
</pre></div>
</div>
<p>Unlocking translational degrees of freedom allows the origin point of actor1's constraint frame to move along a subset of the axes defined by actor0's constraint frame. For example, unlocking just the X-axis creates the equivalent of a prismatic joint.</p>
<p>Rotational degrees of freedom are partitioned as <em>twist</em> (around the X-axis of actor0's constraint frame) and <em>swing</em> (around the Y- and Z- axes). Different effects are achieved by unlocking various combinations of twist and swing.</p>
<ul class="simple">
<li>if just a single degree of angular freedom is unlocked, the result is always equivalent to a revolute joint. It is recommended that if just one angular freedom is unlocked, it should be the twist degree, because the joint has various configuration options and optimizations that are designed for this case.</li>
</ul>
<ul class="simple">
<li>if both swing degrees of freedom are unlocked but the twist degree remains locked, the result is a <em>zero-twist</em> joint. The x-axis of actor1 swings freely away from the x-axis of actor0 but twists to minimize the rotation required to align the two frames. This creates a kind of isotropic universal joint which avoids the problems of the usual 'engineering style' universal joint (see below) that is sometimes used as a kind of twist constraint. There is a nasty singularity at π radians (180 degrees) swing, so a swing limit should be used to avoid the singularity.</li>
</ul>
<ul class="simple">
<li>if one swing and one twist degree of freedom are unlocked but the remaining swing is kept locked, a <em>zero-swing</em> joint results (often also called a <em>universal</em> joint). If for example the SWING1 (y-axis rotation) is unlocked, the x-axis of actor1 is constrained to remain orthogonal to the z-axis of actor0. In character applications, this joint can be used to model an elbow swing joint incorporating the twist freedom of the lower arm or a knee swing joint incorporating the twist freedom of the lower leg. In vehicle applications, these joints can be used as 'steered wheel' joints in which the child actor is the wheel, free to rotate about its twist axis, while the free swing axis in the parent acts as the steering axis. Care must be taken with this combination because of anisotropic behavior and singularities (beware the dreaded gimbal lock) at angles of π/2 radians (90 degrees), making the zero-twist joint a better behaved alternative for most use cases.</li>
</ul>
<ul class="simple">
<li>if all three angular degrees are unlocked, the result is equivalent to a spherical joint.</li>
</ul>
<p>Three of the joints from PhysX 2 that have been removed from PhysX 3 can be implemented as follows:</p>
<ul>
<li><p class="first">The cylindrical joint (with axis along the common x-axis of the two constraint frames) is given by the combination:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span>     <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eTWIST</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
</pre></div>
</div>
</li>
<li><p class="first">the point-on-plane joint (with plane axis along the x-axis of actor0's constraint frame) is given by the combination:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eY</span><span class="p">,</span>      <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eZ</span><span class="p">,</span>      <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eTWIST</span><span class="p">,</span>  <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eSWING1</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eSWING2</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
</pre></div>
</div>
</li>
<li><p class="first">the point-on-line joint (with axis along the x-axis of actor0's constraint frame) is given by the combination:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span>      <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eTWIST</span><span class="p">,</span>  <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eSWING1</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eSWING2</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
</pre></div>
</div>
</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Angular projection is implemented only for the cases when two or three angular degrees of freedom are locked.</p>
</div>
</div>
<div class="section" id="id2">
<h3>Limits<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<p>Instead of specifying that an axis is free or locked, it may also be specified as limited. The D6 supports different limits which may be used in any combination.</p>
<p>A single linear limit with only an upper bound is used to constrain any of the translational degrees of freedom. The limit constrains the distance between the origins of the constraint frames when projected onto these axes. For example, the combination:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eY</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eLIMITED</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eZ</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eLIMITED</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDistanceLimit</span><span class="p">(</span><span class="n">PxJointLinearLimit</span><span class="p">(</span><span class="mf">1.0f</span><span class="p">,</span> <span class="mf">0.1f</span><span class="p">));</span>
</pre></div>
</div>
<p>constrains the y- and z- coordinates of actor1's constraint frame to lie within the unit disc. Since the x-axis is unconstrained, the effect is to constrain the origin of actor1's constraint frame to lie within a cylinder of radius 1 extending along the x-axis of actor0's constraint frame.</p>
<p>The D6 joint also supports per-axis linear limit pairs, with the <em>PxD6Joint::setLinearLimit/PxD6Joint::getLinearLimit</em> functions. This can be used to implement a prismatic joint when only one of the linear axis is limited and the others remain locked. Otherwise in 2D and 3D this gives birth to quad-shaped and box-shaped limit volumes, as opposed to the disc-shaped and sphere-shaped volumes generated by <em>PxD6Joint::setDistanceLimit</em>.</p>
<p>The twist degree of freedom is limited by a pair limit with upper and lower bounds, identical to the limit of the revolute joint.</p>
<p>If both swing degrees of freedom are limited, a limit cone is generated, identical to the limit of the spherical joint. As with the spherical joint, very small or highly elliptical limit cones may result in solver jitter.</p>
<p>If only one swing degree of freedom is limited, the corresponding angle from the cone limit is used to limit rotation. If the other swing degree is locked, the maximum value of the limit is π radians (180 degrees). If the other swing degree is free, the maximum value of the limit is π/2 radians (90 degrees).</p>
</div>
<div class="section" id="drives">
<h3>Drives<a class="headerlink" href="#drives" title="Permalink to this headline">¶</a></h3>
<p>The D6 has a linear drive model, and two possible angular drive models. The drive is a <em>proportional derivative</em> drive, which applies a force as follows:</p>
<p><em>force = spring * (targetPosition - position) + damping * (targetVelocity - velocity)</em></p>
<p>The drive model may also be configured to generate a proportional acceleration instead of a force, factoring in the masses of the actors to which the joint is attached. Acceleration drive is often easier to tune than force drive.</p>
<dl class="docutils">
<dt>The linear drive model for the D6 has the following parameters:</dt>
<dd><ul class="first last simple">
<li>target position, specified in actor0's constraint frame</li>
<li>target velocity, specified in actor0's constraint frame</li>
<li>spring</li>
<li>damping</li>
<li>forceLimit - the maximum force the drive can apply (note that this can be an impulse, depending on PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES)</li>
<li>acceleration drive flag</li>
</ul>
</dd>
</dl>
<p>The drive attempts to follow the desired position input with the configured stiffness and damping properties. A physical lag due to the inertia of the driven body acting through the drive spring will occur; therefore, sudden step changes will result over a number of time steps. Physical lag can be reduced by stiffening the spring or supplying a velocity target.</p>
<p>With a fixed position input and a zero target velocity, a position drive will spring about that drive position with the specified springing/damping characteristics:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="c1">// set all translational degrees free</span>

<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eY</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setMotion</span><span class="p">(</span><span class="n">PxD6Axis</span><span class="o">::</span><span class="n">eZ</span><span class="p">,</span> <span class="n">PxD6Motion</span><span class="o">::</span><span class="n">eFREE</span><span class="p">);</span>

<span class="c1">// set all translation degrees driven:</span>

<span class="n">PxD6Drive</span> <span class="nf">drive</span><span class="p">(</span><span class="mf">10.0f</span><span class="p">,</span> <span class="o">-</span><span class="mf">20.0f</span><span class="p">,</span> <span class="n">PX_MAX_F32</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDrive</span><span class="p">(</span><span class="n">PxD6JointDrive</span><span class="o">::</span><span class="n">eX</span><span class="p">,</span> <span class="n">drive</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDrive</span><span class="p">(</span><span class="n">PxD6JointDrive</span><span class="o">::</span><span class="n">eY</span><span class="p">,</span> <span class="n">drive</span><span class="p">);</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDrive</span><span class="p">(</span><span class="n">PxD6JointDrive</span><span class="o">::</span><span class="n">eZ</span><span class="p">,</span> <span class="n">drive</span><span class="p">);</span>

<span class="c1">// Drive the joint to the local(actor[0]) origin - since no angular</span>
<span class="c1">// dofs are free, the angular part of the transform is ignored</span>

<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDrivePosition</span><span class="p">(</span><span class="n">PxTransform</span><span class="p">(</span><span class="mf">1.0f</span><span class="p">));</span>
<span class="n">d6joint</span><span class="o">-&gt;</span><span class="n">setDriveVelocity</span><span class="p">(</span><span class="n">PxVec3</span><span class="p">(</span><span class="n">PxZero</span><span class="p">));</span>
</pre></div>
</div>
<p>Angular drive differs from linear drive in a fundamental way: it does not have a simple and intuitive representation free from singularities. For this reason, the D6 joint provides two angular drive models - twist and swing and SLERP (Spherical Linear Interpolation).</p>
<p>The two models differ in the way they estimate the path in quaternion space between the current orientation and the target orientation. In a SLERP drive, the quaternion is used directly. In a twist and swing drive, it is decomposed into separate twist and swing components and each component is interpolated separately. Twist and swing is intuitive in many situations; however, there is a singularity when driven to 180 degrees swing. In addition, the drive will not follow the shortest arc between two orientations. On the other hand, SLERP drive will follow the shortest arc between a pair of angular configurations, but may cause unintuitive changes in the joint's twist and swing.</p>
<p>The angular drive model has the following parameters:</p>
<blockquote>
<div><ul class="simple">
<li>An angular velocity target specified relative to actor0's constraint frame</li>
<li>An orientation target specified relative to actor0's constraint frame</li>
<li>drive specifications for SLERP (slerpDrive), swing (swingDrive) and twist (twistDrive):</li>
<li>spring - amount of torque needed to move the joint to its target orientation proportional to the angle from the target (not used for a velocity drive).</li>
<li>damping - applied to the drive spring (used to smooth out oscillations about the drive target).</li>
<li>forceLimit - the maximum torque the drive can apply (note that this can be an impulsive torque, depending on the value PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES)</li>
<li>acceleration drive flag. If this flag is set the acceleration (rather than the force) applied by the drive is proportional to the angle from the target.</li>
</ul>
</div></blockquote>
<p>Best results will be achieved when the drive target inputs are consistent with the joint freedom and limit constraints.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">if any angular degrees of freedom are locked, the SLERP drive parameters are ignored. If all angular degrees of freedom are unlocked, and parameters are set for multiple angular drives, the SLERP parameters will be used.</p>
</div>
</div>
<div class="section" id="configuring-joints-for-best-behavior">
<h3>Configuring Joints for Best Behavior<a class="headerlink" href="#configuring-joints-for-best-behavior" title="Permalink to this headline">¶</a></h3>
<p>The behavior quality of joints in PhysX is largely determined by the ability of the iterative solver to converge. Better convergence can be achieved simply by increasing the attributes of the PxRigidDynamic which controls the solver iteration count. However, joints can also be configured to produce better convergence.</p>
<ul class="simple">
<li>the solver can have difficulty converging well when a light object is constrained between two heavy objects. Mass ratios of higher than 10 are best avoided in such scenarios.</li>
<li>when one body is significantly heavier than the other, make the lighter body the second actor in the joint. Similarly, when one of the objects is static or kinematic (or the actor pointer is NULL) make the dynamic body the second actor.</li>
</ul>
<p>A common use for joints is to move objects around in the world. Best results are obtained when the solver has access to the velocity of motion as well as the change in position.</p>
<ul class="simple">
<li>if you want a very stiff controller that moves the object to specific position each frame, consider jointing the object to a kinematic actor and use the setKinematicTarget function to move the actor.</li>
<li>if you want a more springy controller, use a D6 joint with a drive target to set the desired position and orientation, and control the spring parameters to increase stiffness and damping.  In general, acceleration drive is much easier to tune than force drive.</li>
</ul>
<p>When using mass scaling or when constraining bodies with infinite inertia along some axes, the reduction in degrees of freedom of the rigid bodies combined with small inaccuracies in floating point calculation can produce arbitrarily stiff constraint responses trying to correct unnoticeably small errors. This can appear, for example, when attempting to perform 2D-simulation using infinite inertia to suppress velocity out of the plane of simulation. In these cases, set the flag PxConstraintFlag::eDISABLE_PREPROCESSING, and set the minResponseThreshold on the constraint to a small value, e.g. 1e-8. This will result in such stiff constraint rows being ignored when encountered, and can considerably improve simulation quality.</p>
</div>
</div>
<div class="section" id="custom-constraints">
<h2>Custom Constraints<a class="headerlink" href="#custom-constraints" title="Permalink to this headline">¶</a></h2>
<p>It is also possible to add new joint types to PhysX. Use the existing joints in the PhysXExtensions library as a reference, and also the source for SnippetCustomJoint, which shows how to implement a Pulley Joint. Serializing custom objects is discussed in the chapter <a class="reference internal" href="Serialization.html#serialization"><em>Serialization</em></a>, so the discussion here is limited to how to achieve the desired behavior in simulation. This is an advanced topic, and assumes familiarity with the mathematics underlying rigid body simulation. The presentation here assumes that the joint constrains two bodies; the case for a static body is equivalent to a dynamic body of infinite mass whose transform is the identity.</p>
<p>The functions which implement dynamic behavior of joints are PhysX <em>shaders</em>, similar in nature to the PxFilterShader (see <a class="reference internal" href="RigidBodyCollision.html#collisionfiltering"><em>Collision Filtering</em></a>). In particular, the functions may execute in parallel and asynchronously, and should not access any state except that passed in as parameters.</p>
<p>To create a custom joint class, define the following:</p>
<ul class="simple">
<li>the functions which implement the behavior of the constraint. The functions must be stateless, because they may be called simultaneously from multiple threads. When each function is called, PhysX passes a <em>constant block</em> which can be used to store the joint configuration parameters (offsets, axes, limits etc).</li>
<li>a static instance of PxConstraintShaderTable containing pointers to the functions</li>
<li>a class implementing the PxConstraintConnector interface, that connects the custom joint to PhysX.</li>
</ul>
<div class="section" id="defining-constraint-behavior">
<h3>Defining Constraint Behavior<a class="headerlink" href="#defining-constraint-behavior" title="Permalink to this headline">¶</a></h3>
<p>There are two functions that define the joint behavior: the <em>solver preparation</em> function, which generates inputs to PhysX' velocity-based constraint solver, and the <em>projection</em> function, which allows direct correction of position error.</p>
<p>The processing sequence during simulation is as follows:</p>
<ul class="simple">
<li>in the simulate() function, before starting simulation the scene updates an internal copy of the joint's constant block (so that the joint's copy may be modified during simulation without causing races).</li>
<li>collision detection runs, and may wake bodies. If the joint connects two bodies, the simulation will ensure that either both bodies are awake, or neither is.</li>
<li>for every joint connected to an awake body, the simulation calls the solver preparation function.</li>
<li>the solver updates body velocities and positions.</li>
<li>if the constraint's ePROJECTION flag is set, the simulation calls the joint projection function.</li>
</ul>
<div class="section" id="the-solver-preparation-function">
<h4>The Solver Preparation Function<a class="headerlink" href="#the-solver-preparation-function" title="Permalink to this headline">¶</a></h4>
<p>The solver preparation function for a joint has the following signature:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxU32</span> <span class="nf">prepare</span><span class="p">(</span><span class="n">Px1DConstraint</span><span class="o">*</span> <span class="n">constraints</span><span class="p">,</span>
              <span class="n">PxVec3</span><span class="o">&amp;</span> <span class="n">bodyAWorldOffset</span><span class="p">,</span>
              <span class="n">PxU32</span> <span class="n">maxConstraints</span><span class="p">,</span>
              <span class="n">PxConstraintInvMassScale</span> <span class="o">&amp;</span><span class="n">invMassScale</span><span class="p">,</span>
              <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">constantBlock</span><span class="p">,</span>
              <span class="k">const</span> <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">bA2w</span><span class="p">,</span>
              <span class="k">const</span> <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">bB2w</span><span class="p">);</span>
</pre></div>
</div>
<p>The parameters are as follows:</p>
<ul class="simple">
<li><em>constraints</em> is the output buffer of constraint rows.</li>
<li><em>bodyAWorldOffset</em> is the point, specified in world space as an offset from the origin of bodyA, at which the constraint forces act to enforce the joint. The constraint solver ignores this value as the information is already encoded in the constraint array, but when reporting forces it is necessary to choose a point at which the force is considered to act. For PhysX joints, the attachment point of the joint on body B is used.</li>
<li><em>maxConstraints</em> is the size of the buffer, which limits the number of constraint rows that may be generated.</li>
<li><em>invMassScale</em> is the inverse mass scales which should be applied to the bodies for the purpose of resolving the joint. In the standard joints, these are just the joint's mass scaling parameters (see <a class="reference internal" href="#joint-mass-scaling"><em>Mass Scaling</em></a>).</li>
<li><em>constantBlock</em> is the simulation's copy of the joint constant block.</li>
<li><em>bA2w</em> is the transform of the first body. It is the identity transform if the actor is static, or a NULL pointer was supplied in constraint creation.</li>
<li><em>bB2w</em> is the transform of the second body. It is the identity transform if the actor is static, or a NULL pointer was supplied in constraint creation.</li>
</ul>
<p>The role of the solver preparation function is to populate the buffer of Px1DConstraints, provide the point of application for force reporting, and provide the mass scaling properties. The return value is the number of Px1DConstraints generated in the output buffer.</p>
<p>Notice that although the joint parameters (relative pose etc) are typically specified relative to an actor, the solver preparation function works with the transforms of the underlying rigid bodies. The constraint infrastructure (see <a class="reference internal" href="#constraint-infrastructure"><em>Data Management</em></a>) assists joints in maintaining consistency when, for example, the application modifies the center of mass of an actor.</p>
<p>Each Px1D constraint constrains one degree of freedom between the two bodies. The structure looks like this:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">struct</span> <span class="n">Px1DConstraint</span>
<span class="p">{</span>
    <span class="n">PxVec3</span>                <span class="n">linear0</span><span class="p">;</span>
    <span class="n">PxReal</span>                <span class="n">geometricError</span><span class="p">;</span>
    <span class="n">PxVec3</span>                <span class="n">angular0</span><span class="p">;</span>
    <span class="n">PxReal</span>                <span class="n">velocityTarget</span><span class="p">;</span>

    <span class="n">PxVec3</span>                <span class="n">linear1</span><span class="p">;</span>
    <span class="n">PxReal</span>                <span class="n">minImpulse</span><span class="p">;</span>
    <span class="n">PxVec3</span>                <span class="n">angular1</span><span class="p">;</span>
    <span class="n">PxReal</span>                <span class="n">maxImpulse</span><span class="p">;</span>

    <span class="k">union</span>
    <span class="p">{</span>
        <span class="k">struct</span> <span class="n">SpringModifiers</span>
        <span class="p">{</span>
            <span class="n">PxReal</span>        <span class="n">stiffness</span><span class="p">;</span>
            <span class="n">PxReal</span>        <span class="n">damping</span><span class="p">;</span>
        <span class="p">}</span> <span class="n">spring</span><span class="p">;</span>
        <span class="k">struct</span> <span class="n">RestitutionModifiers</span>
        <span class="p">{</span>
            <span class="n">PxReal</span>        <span class="n">restitution</span><span class="p">;</span>
            <span class="n">PxReal</span>        <span class="n">velocityThreshold</span><span class="p">;</span>
        <span class="p">}</span> <span class="n">bounce</span><span class="p">;</span>
    <span class="p">}</span> <span class="n">mods</span><span class="p">;</span>

    <span class="n">PxReal</span>               <span class="n">forInternalUse</span><span class="p">;</span>
    <span class="n">PxU16</span>                <span class="n">flags</span><span class="p">;</span>
    <span class="n">PxU16</span>                <span class="n">solveHint</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Each Px1DConstraint is either a hard constraint (for example, one axis of a fixed joint) or a soft constraint (for example, a spring). A joint may have a mixture of hard and soft constraint rows - for example, the actuated joint at a rag doll shoulder often has:</p>
<ul class="simple">
<li>3 hard 1D-constraints which prevent the shoulder from separating.</li>
<li>3 hard 1D-constraints constraining the angular degrees of freedom within some limits.</li>
<li>3 soft constraints simulating resistance to angular motion from muscles.</li>
</ul>
<p>The constraint is treated as hard unless the Px1DConstraintFlag::eSPRING flag is set.</p>
<p>For both soft and hard constraints, the <em>solver velocity</em> for each row is the quantity:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">v</span> <span class="o">=</span> <span class="n">body0vel</span><span class="p">.</span><span class="n">dot</span><span class="p">(</span><span class="n">lin0</span><span class="p">,</span> <span class="n">ang0</span><span class="p">)</span> <span class="o">-</span> <span class="n">body1vel</span><span class="p">.</span><span class="n">dot</span><span class="p">(</span><span class="n">lin1</span><span class="p">,</span> <span class="n">ang1</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="hard-constraints">
<h5>Hard Constraints<a class="headerlink" href="#hard-constraints" title="Permalink to this headline">¶</a></h5>
<p>For a hard constraint, the solver attempts to generate:</p>
<ul>
<li><p class="first">a set of motion solver velocities vMotion for objects which, when integrated, respect the constraint errors, represented by the equation:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">vMotion</span> <span class="o">+</span> <span class="p">(</span><span class="n">geometricError</span> <span class="o">/</span> <span class="n">timestep</span><span class="p">)</span> <span class="o">=</span> <span class="n">velocityTarget</span>
</pre></div>
</div>
</li>
<li><p class="first">a set of post-simulation solver velocities vNext for the objects which respect the constraints:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">vNext</span> <span class="o">=</span> <span class="n">velocityTarget</span>
</pre></div>
</div>
</li>
</ul>
<p>The motion velocities are used for integration and then discarded. The post-simulation velocities are the values that getLinearVelocity() and getAngularVelocity() return.</p>
<p>There are two special options for hard constraints, both most often used to implement limits: restitution and velocity biasing. They are set by the constraint flags eRESTITUTION and eKEEPBIAS, are mutually exclusive, and restitution takes priority (in the sense that if restitution is set, biasing is ignored).</p>
<p>Restitution simulates bouncing (off a limit, for example). If the impact solver velocity vCurrent at the start of simulation exceeds the restitution velocity threshold, the target velocity of the constraint will be set to:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">restitution</span> <span class="o">*</span> <span class="o">-</span><span class="n">vCurrent</span>
</pre></div>
</div>
<p>and the input velocityTarget field will be ignored. To use restitution, set Px1DConstraintFlag::eRESTITUTION.</p>
<p>Velocity biasing generates post-simulation velocities to satisfy the same constraints as for the motion velocities:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">vNext</span> <span class="o">+</span> <span class="p">(</span><span class="n">geometricError</span> <span class="o">/</span> <span class="n">timestep</span><span class="p">)</span> <span class="o">=</span> <span class="n">velocityTarget</span>
</pre></div>
</div>
<p>This can be useful if, for example, the joint is approaching a limit but has not yet reached it. If the target velocity is 0 and the geometric error is the distance remaining to the limit, the solver will constrain the velocity below that required to violate the limit after integration. The joint should then converge smoothly to the limit.</p>
</div>
<div class="section" id="soft-constraints">
<h5>Soft Constraints<a class="headerlink" href="#soft-constraints" title="Permalink to this headline">¶</a></h5>
<p>Alternatively, the solver can attempt to resolve the velocity constraint as an implicit spring. In this case, the motion velocity vMotion and post-simulation velocity vNext are the same. The solver solves the equation:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">F</span> <span class="o">=</span> <span class="n">stiffness</span> <span class="o">*</span> <span class="o">-</span><span class="n">geometricError</span> <span class="o">+</span> <span class="n">damping</span> <span class="o">*</span> <span class="p">(</span><span class="n">velocityTarget</span> <span class="o">-</span> <span class="n">v</span><span class="p">)</span>
</pre></div>
</div>
<p>where F is the constraint force.</p>
<p>Springs are fully implicit: that is, the force or acceleration is a function of the position and velocity after the solve. There is one special option that applies only to soft constraints: acceleration springs (PxConstraintFlag::eACCELERATION). With this option the solver will scale the magnitude of the force in accordance with the response of the two bodies; effectively it implicitly solves the equation:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">acceleration</span> <span class="o">=</span> <span class="n">stiffness</span> <span class="o">*</span> <span class="o">-</span><span class="n">geometricError</span> <span class="o">+</span> <span class="n">damping</span> <span class="o">*</span> <span class="p">(</span><span class="n">velocityTarget</span> <span class="o">-</span> <span class="n">v</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="force-limits-and-reporting">
<h5>Force Limits and Reporting<a class="headerlink" href="#force-limits-and-reporting" title="Permalink to this headline">¶</a></h5>
<p>All constraints support limits on the minimum or maximum impulse applied for each row. There is a special flag for force limits: eHAS_DRIVE_FORCE_LIMIT. If this flag is set, the force limits will be scaled by the timestep unless PxConstraintFlag::eLIMITS_ARE_FORCES is set for the constraint.</p>
<p>The flag eOUTPUT_FORCE flag on a 1D constraint determines whether the force applied for this row should be included in the constraint force output. The reporting force is also used internally to determine joint breakage. For example, if creating a spherical joint with angular drive that breaks when the stress on the linear part exceeds a threshold, set the flag for the linear equality rows but not the angular drive rows.</p>
</div>
<div class="section" id="solver-preprocessing">
<h5>Solver Preprocessing<a class="headerlink" href="#solver-preprocessing" title="Permalink to this headline">¶</a></h5>
<p>The joint solver attempts to preprocess hard constraints to improve convergence. The solveHint value controls preprocessing for each row:</p>
<ul class="simple">
<li>if the constraint is a hard equality constraint with unbounded impulse limits (i.e. the impulse limits are -PX_MAX_FLT and PX_MAX_FLT), set this to PxConstraintSolveHint::eEQUALITY.</li>
<li>If one of the force limits is zero and the other unbounded, set it to PxConstraintSolveHint::eINEQUALITY.</li>
<li>for all soft constraints, and hard constraints with impulse limits other than the above, set it to PxConstraintSolveHint::eNONE.</li>
</ul>
<p>The solver does not check that the hint value is consistent with the values in the Px1DConstraint. Using inconsistent values may result in undefined behavior.</p>
</div>
</div>
<div class="section" id="the-projection-function">
<h4>The Projection Function<a class="headerlink" href="#the-projection-function" title="Permalink to this headline">¶</a></h4>
<p>The other behavior that joints may specify for simulation is <em>projection</em>. This is a purely positional correction designed to act when the velocity-based solver fails. The projection function has the following signature:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">typedef</span> <span class="nf">void</span> <span class="p">(</span><span class="o">*</span><span class="n">PxConstraintProject</span><span class="p">)(</span><span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">constantBlock</span><span class="p">,</span>
                                    <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">bodyAToWorld</span><span class="p">,</span>
                                    <span class="n">PxTransform</span><span class="o">&amp;</span> <span class="n">bodyBToWorld</span><span class="p">,</span>
                                    <span class="kt">bool</span> <span class="n">projectToA</span><span class="p">);</span>
</pre></div>
</div>
<p>It receives the constant block and the two body transforms. It should update the bodyBToWorld transform if the projectToA flag is set, and otherwise the bodyBToWorld transform. See the implementations in the extensions library for examples of how to define projection functions.</p>
</div>
</div>
<div class="section" id="the-constraint-shader-table">
<h3>The Constraint Shader Table<a class="headerlink" href="#the-constraint-shader-table" title="Permalink to this headline">¶</a></h3>
<p>After coding the behavior functions, define a structure of type PxConstraintShaderTable, which holds the pointers to the constraint functions. This structure will be passed as an argument to PxPhysics::createConstraint, and is shared by all instances of the joint:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">struct</span> <span class="n">PxConstraintShaderTable</span>
<span class="p">{</span>
    <span class="n">PxConstraintSolverPrep</span>          <span class="n">solverPrep</span><span class="p">;</span>
    <span class="n">PxConstraintProject</span>             <span class="n">project</span><span class="p">;</span>
    <span class="n">PxConstraintVisualize</span>           <span class="n">visualize</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
</div>
<p>The constraint visualizer allows the joint to generate visualization information using the PxConstraintVisualizer interface. The functionality of this interface is somewhat biased towards the standard joints; examples of its use can be found in the extensions library.</p>
</div>
<div class="section" id="data-management">
<span id="constraint-infrastructure"></span><h3>Data Management<a class="headerlink" href="#data-management" title="Permalink to this headline">¶</a></h3>
<p>Next, define the class which lets PhysX manage the joint. This class should inherit from the PxConstraintConnector interface.</p>
<p>To create a joint, call PxPhysics::createConstraint. The arguments to this function are the constrained actors, the connector object, the shader table, and the size of the joint's constant block. The return value is a pointer to PxConstraint object.</p>
<p>PxConstraintConnector has a number of data management callbacks:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">virtual</span> <span class="kt">void</span><span class="o">*</span>           <span class="nf">prepareData</span><span class="p">();</span>
<span class="k">virtual</span> <span class="kt">void</span>            <span class="nf">onConstraintRelease</span><span class="p">();</span>
<span class="k">virtual</span> <span class="kt">void</span>            <span class="nf">onComShift</span><span class="p">(</span><span class="n">PxU32</span> <span class="n">actor</span><span class="p">);</span>
<span class="k">virtual</span> <span class="kt">void</span>            <span class="nf">onOriginShift</span><span class="p">(</span><span class="k">const</span> <span class="n">PxVec3</span><span class="o">&amp;</span> <span class="n">shift</span><span class="p">);</span>
<span class="k">virtual</span> <span class="kt">void</span><span class="o">*</span>           <span class="nf">getExternalReference</span><span class="p">(</span><span class="n">PxU32</span><span class="o">&amp;</span> <span class="n">typeID</span><span class="p">);</span>
</pre></div>
</div>
<p>These functions are usually boilerplate; sample implementations can be found for the joints in the extensions library:</p>
<ul class="simple">
<li>The prepareData() function requests a pointer to the joint constant block, and allows the joint to update any state caches etc. When the function returns, the scene makes an internal copy of this data, so that the joint may be modified during simulation without race conditions. The function is called at the start of the simulation step after the joint is inserted into the scene, and on a subsequent simulation step if PhysX is informed that the joint's state has changed.  To inform PhysX that the joint state has changed, call PxConstraint::markDirty().</li>
<li>onConstraintRelease() is associated with joint deletion. To delete a joint, call PxConstraint::release() on the constraint. When it is safe to destroy the joint (because no internal references are being held by currently executing simulation threads) the constraint code will call PxConstraint::onConstraintRelease(). This function can safely run the destructor and release the joint's memory etc.</li>
<li>onComShift() is called when the application calls setCMassLocalPose() on one of the actors connected by the joint. This is provided because the solver preparation and projection functions are defined using the frame of the underlying rigid body, but the joint configuration is typically defined in terms of the actors.</li>
<li>onOriginShift() is called when the application shifts the origin of a scene. This is necessary because some joints may have a NULL actor, signifying that they are attached to the world frame.</li>
<li>getExternalReference() is used by PhysX to report simulation events involving constraints, particularly breakage. The returned pointer is passed directly to the application in the event callback, along with the typeID which the application can use in order to cast the pointer to the appropriate type. The typeID should be distinct for each custom joint type, and different from any of the values in PxJointConcreteType. If the joint also implements the PxBase interface, use the concrete type value from PxBase for the typeID.</li>
</ul>
</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="Articulations.html" class="btn btn-neutral float-right" title="Articulations" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="AdvancedCollisionDetection.html" class="btn btn-neutral" title="Advanced Collision Detection" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2008-2021 NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, CA 95051 U.S.A. All rights reserved

    </p>
  </div> 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    
    
      <script type="text/javascript">
          var DOCUMENTATION_OPTIONS = {
              URL_ROOT:'../',
              VERSION:'4.1',
              LANGUAGE:'',
              COLLAPSE_INDEX:false,
              FILE_SUFFIX:'.html',
              HAS_SOURCE:  true,
              SOURCELINK_SUFFIX: ''
          };
      </script>
        <script type="text/javascript" src="../_static/jquery.js"></script>
        <script type="text/javascript" src="../_static/underscore.js"></script>
        <script type="text/javascript" src="../_static/doctools.js"></script>
    

  

  <script type="text/javascript" src="../_static/js/theme.js"></script>

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(false);
      });
  </script> 

</body>
</html>